Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/collect

Package Overview
Dependencies
Maintainers
4
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/collect

turf collect module

  • 3.14.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
490K
increased by126.02%
Maintainers
4
Weekly downloads
 
Created

What is @turf/collect?

@turf/collect is a module from the Turf.js library that allows you to collect properties from one set of features (points) and aggregate them into another set of features (polygons). This is particularly useful for spatial analysis tasks where you need to summarize or aggregate data based on spatial relationships.

What are @turf/collect's main functionalities?

Collect properties from points into polygons

This feature allows you to collect properties from a set of point features and aggregate them into polygon features. In this example, the population property from the points is collected into the polygons.

const turf = require('@turf/turf');

const points = turf.featureCollection([
  turf.point([0, 0], {population: 200}),
  turf.point([2, 2], {population: 300}),
  turf.point([2, 0], {population: 150})
]);

const polygons = turf.featureCollection([
  turf.polygon([[
    [0, 0], [2, 0], [2, 2], [0, 2], [0, 0]
  ]], {name: 'polygon1'})
]);

const collected = turf.collect(polygons, points, 'population', 'collectedPopulations');
console.log(JSON.stringify(collected, null, 2));

Other packages similar to @turf/collect

Keywords

FAQs

Package last updated on 22 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc